<h2>Why is this an issue?</h2>
<p>Passing a collection as an argument to the collection’s own method is a code defect. Doing so might either have unexpected side effects or always
have the same result.</p>
<p>Another case is using set-like operations. For example, using <a
href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.union">Union</a> between a list and itself will always return the same list.
Conversely, using <a href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except">Except</a> between a list and itself will
always return an empty list.</p>
<p>Exceptions to this rule are the methods <a
href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.addrange"><code>AddRange</code></a> and <a
href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.concat"><code>Concat</code></a>, since the developer can use them to
multiply the list elements or the list itself respectively.</p>
<pre>
var list = new List&lt;int&gt;();

list.Union(list);             // Noncompliant: always returns list
list.Intersect(list);         // Noncompliant: always returns list
list.Except(list);            // Noncompliant: always returns empty
list.SequenceEqual(list);     // Noncompliant: always returns true

var set = new HashSet&lt;int&gt;();
set.UnionWith(set);           // Noncompliant: no changes
set.IntersectWith(set);       // Noncompliant: no changes
set.ExceptWith(set);          // Noncompliant: always returns empty
set.SymmetricExceptWith(set); // Noncompliant: always returns empty
set.IsProperSubsetOf(set);    // Noncompliant: always returns false
set.IsProperSupersetOf(set);  // Noncompliant: always returns false
set.IsSubsetOf(set);          // Noncompliant: always returns true
set.IsSupersetOf(set);        // Noncompliant: always returns true
set.Overlaps(set);            // Noncompliant: always returns true
set.SetEquals(set);           // Noncompliant: always returns true

list.AddRange(list);          // Compliant
list.Concat(list);            // Compliant
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/collections">Collections</a> </li>
</ul>

